//
//  houqinViewController.m
//  shuilijuOASystem
//
//  Created by michael on 16/6/28.
//  Copyright © 2016年 czd. All rights reserved.
//
#import "EatViewController.h"
#import "MeetingViewController.h"
#import "houqinViewController.h"

@interface houqinViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)NSArray* array;

@end

@implementation houqinViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    self.title = @"后勤管理";
    [self.view addSubview:_tableView];
     UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:nil action:nil];
    self.navigationItem.backBarButtonItem = barButtonItem;

    _array = [NSArray arrayWithObjects:@"会议管理",@"食堂管理",nil];

    // Do any additional setup after loading the view.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//       static NSString * cellIdentifier = @"cellIdentifier";
//            UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
//            if (cell == nil) {
//                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
//            }
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 40, 40)];
    image.image = [UIImage imageNamed: _array[indexPath.row]];
[cell.contentView addSubview:image];
//    cell.imageView.image = [UIImage imageNamed: _array[indexPath.row]];
    cell.imageView.size = CGSizeMake(30 ,30);
    UILabel *textLabel = [[UILabel alloc]init];
    textLabel.frame = CGRectMake(image.right+10, 5, 100, 60);
    textLabel.text = _array[indexPath.row];
    [cell.contentView addSubview:textLabel];
    
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70;
}

- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

if (indexPath.row==0) {


   MeetingViewController *comthvc = [[MeetingViewController alloc]init];
          [self.navigationController pushViewController:comthvc animated:YES];}
if(indexPath.row==1) {
   EatViewController *eat = (EatViewController *)[storyBoard instantiateViewControllerWithIdentifier:@"eat"];
       [self.navigationController pushViewController:eat animated:YES];
}



}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
